package cn.wjssl.infrastructure.persistent.dao;

import cn.bugstack.middleware.db.router.annotation.DBRouter;
import cn.wjssl.infrastructure.persistent.po.UserCreditAccountPO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户积分账户
 */
@Mapper
public interface IUserCreditAccountDao {

    // 新增用户积分账户
    int insert(UserCreditAccountPO userCreditAccountPO);

    // 更新账户, 增加 [积分总数, 可用积分]
    int updateAddAmount(UserCreditAccountPO userCreditAccountPO);

    // 查询用户积分账户
    UserCreditAccountPO queryUserCreditAccount(UserCreditAccountPO creditAccountPO);

    @DBRouter
    UserCreditAccountPO queryUserCreditAccountByUserId(UserCreditAccountPO creditAccountPO);

    // 扣减账户积分
    int updateSubtractionAmount(UserCreditAccountPO creditAccountPO);

}
